package org.example.util;

/**
 * @Description 文件类型枚举
 * @Author xiaohuang
 * @Date 2024/7/29
 */

public enum FileType {
    XLS(".xlsx","application/vnd.ms-excel;charset=utf-8"),
    DOCX(".docx","application/msword;charset=utf-8"),
    PDF(".pdf","application/pdf;charset=utf-8");
    private final String type;
    private final String desc;
    FileType(String type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public String getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }
    public static FileType getByType(String type){
        FileType[] values = values();
        for (FileType value : values) {
            if (value.getType().equals(type))
                return value;
        }
        return null;
    }

}
